package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func main() {
	// 以带缓存的形式读取文件内容
	file, err := os.Open("D:\\钉钉接入.txt")

	if err != nil {
		// The system cannot find the file01 specified.
		fmt.Println("open file01 error = ", err)
	}
	// 退出时关闭 defer
	defer file.Close()
	// defaultBufSize = 4096
	reader := bufio.NewReader(file)
	// 循环读取内容
	for {
		str, err1 := reader.ReadString('\n') // 读取到一个换行就结束
		if err1 == io.EOF {                  // EOF 文件末尾
			break
		}
		fmt.Printf(str)
		/*if err1 != nil{
			// The system cannot find the file01 specified.
			fmt.Println("reader err1 = ",err1)
		}*/
	}
	fmt.Println("文件读取结束")
}
